﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Kaiser.Modules.DC.Repositories;

namespace Kaiser.Modules.DC.Services.Impl
{
    public class DCManageService : IDCManageService
    {
        private readonly IDCRepositories _repository;

        public DCManageService(IDCRepositories repository)
        {
            _repository = repository;//
        }

        public int DeleteProductList(string ids)
        {
            try
            {
                return _repository.DeleteProductList(ids);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public void InsertProduct(Models.ProductInput model)
        {
            try
            {
                _repository.InsertProduct(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public void UpdateProduct(Models.ProductInput model)
        {
            try
            {
                _repository.UpdateProduct(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public Kaiser.Models.DataGrid<Models.ProductInput> SearchProduct(Models.DCSearch search, Kaiser.Models.PagingInfo pageinfo)
        {
            try
            {
                return _repository.SearchProduct(search, pageinfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public Kaiser.Models.DataGrid<Models.OrderDetailInput> SearchOrderDetail(Models.DCSearch search, Kaiser.Models.PagingInfo pageinfo)
        {
            try
            {
                return _repository.SearchOrderDetail(search, pageinfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public int DeleteOrderList(string ids)
        {
            try
            {
                return _repository.DeleteOrderList(ids);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public int DeleteOrderDetailList(string ids)
        {
            try
            {
                return _repository.DeleteOrderDetailList(ids);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public void InsertOrderDetail(Models.OrderDetailInput model)
        {
            try
            {
                  _repository.InsertOrderDetail(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public void UpdateOrderDetail(Models.OrderDetailInput model)
        {
            try
            {
                _repository.UpdateOrderDetail(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public void InsertOrder(Models.OrderInput model)
        {
            try
            {
                _repository.InsertOrder(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public void UpdateOrder(Models.OrderInput model)
        {
            try
            {
                _repository.UpdateOrder(model);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public Kaiser.Models.DataGrid<Models.OrderStatisticsInput> OrderStatisticsList(Models.DCSearch search, Kaiser.Models.PagingInfo pageinfo)
        {
            try
            {
               return _repository.OrderStatisticsList(search, pageinfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public Kaiser.Models.DataGrid<Models.OrderDetailStatistics> OrderDetailStatisticsList(Models.DCSearch search, Kaiser.Models.PagingInfo pageinfo)
        {
            try
            {
                return _repository.OrderDetailStatisticsList(search, pageinfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }

        public Kaiser.Models.DataGrid<Models.OrderInput> SearchOrder(Models.DCSearch search, Kaiser.Models.PagingInfo pageinfo)
        {
            try
            {
                return _repository.SearchOrder(search, pageinfo);
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
    }
}
